import Layout from '@/components/Layout.vue'

let routes = [
    {
        path: '/',
        component: Layout,
        title: '根目录',
        //将首页重定向到仪表盘界面
        redirect: { path: '/dashboard' },
        meta: {
            title: '根目录',
            icon: 'el-icon-guide',
            hidden: true

        },
        children: [
            {
                path: 'home',
                title: '主页',
                meta: {
                    title: '主页',
                    icon: 'el-icon-news',
                },
                //异步加载主件
                component: () => import('../src/components/Home'),
            },
            {
                path: 'dashboard',
                title: '仪表盘',
                meta: {
                    title: '仪表盘',
                    icon: 'el-icon-price-tag'
                },
                component: () => import('../src/views/dashboard.vue'),
            }
        ]
    },
    //用户管理
    {
        path: '/usermanagement',
        component: Layout,
        name: 'usermanagement',
        title: '用户管理',
        meta: {
            title: '用户管理',
            icon: 'el-icon-connection'
        },
        children: [
            {
                path: 'generaluser',
                title: '普通用户',
                name: 'generaluser',
                meta: {
                    title: '普通用户',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/generaluser.vue'),
            },
            {
                path: 'administratorlist',
                title: '管理员列表',
                name: 'administratorlist',
                meta: {
                    title: '管理员列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/administratorlist.vue'),
            },
        ],
    },
    //商品管理
    {
        path: '/commoditymanagement',
        component: Layout,
        name: 'commoditymanagement',
        title: '商品管理',
        meta: {
            title: '商品管理',
            icon: 'el-icon-connection'
        },
        children: [
            {
                path: 'productlist',
                title: '商品列表',
                name: 'productlist',
                meta: {
                    title: '商品列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/productlist.vue'),

            },
            {
                path: 'productlist/add',
                title: '新增',
                name: 'add',
                meta: {
                    hidden: true,
                    title: '新增',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/add.vue')
            },
            {
                path: 'classificationparameters',
                title: '分类参数',
                name: 'classificationparameters',
                meta: {
                    title: '分类参数',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/classificationparameters.vue'),
            },
            {
                path: 'categories',
                title: '商品分类',
                name: 'categories',
                meta: {
                    title: '商品分类',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/categories.vue'),
            },

        ],
    },
    //店铺管理
    {
        path: '/storemanagement',
        component: Layout,
        name: 'storemanagement',
        title: '店铺管理',
        meta: {
            title: '店铺管理',
            icon: 'el-icon-connection'
        },
        children: [
            {
                path: 'supplierlist',
                title: '供应商列表',
                name: 'supplierlist',
                meta: {
                    title: '供应商列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/supplierlist.vue'),
            },
            {
                path: 'merchantlist',
                title: '商家列表',
                name: 'merchantlist',
                meta: {
                    title: '商家列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/merchant.vue'),
            },


        ],
    },
    //订单管理
    {
        path: '/ordermanagement',
        component: Layout,
        name: 'ordermanagement',
        title: '订单管理',
        meta: {
            title: '订单管理',
            icon: 'el-icon-connection'
        },
        children: [
            {
                path: 'orderlist',
                title: '订单列表',
                name: 'orderlist',
                meta: {
                    title: '订单列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/orderlist.vue'),
            }

        ],
    },
    //支付方式管理
    {
        path: '/paymentmethodmanagement',
        component: Layout,
        name: 'paymentmethodmanagement',
        title: '支付方式管理',
        meta: {
            title: '支付方式管理',
            icon: 'el-icon-connection'
        },
        children: [
            {
                path: 'paylist',
                title: '支付列表',
                name: 'paylist',
                meta: {
                    title: '支付列表',
                    icon: 'el-icon-open'
                },
                component: () => import('../src/views/paylist.vue'),
            }

        ],
    },
    //登录
    {
        path: '/login',
        meta: {
            title: '登录',
            icon: 'el-icon-coin',
            hidden: true
        },
        component: () => import('../src/views/login.vue'),

    }
]

export default routes
